package com.study;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 *
 * 被监控的服务加了managemen.server.port = 8090; server.port = 8082; server.servlet.context-path= /ribbon;
 *             eureka.instance.metadata-map.management.port =8090
 * 将eureka的port与 服务本身的port区分开
 *
 * 本身服务的端口：
 * http://10.0.68.72:8082/ribbon/ribbon/1
 *
 * /health的端口：
 * http://172.0.0.1:8090/actuator/health  或
 * http://172.0.0.1:8090/actuator/hystrix.stream
 */
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker
public class RibbonHystrixApp4 {
	
	@Bean
	@LoadBalanced
    //负载均衡：默认为轮训
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}
	
	public static void main(String[] args) {
		SpringApplication application = new SpringApplication(RibbonHystrixApp4.class);
		ConfigurableApplicationContext context = application.run(args);
		
		System.out.println("======================end=======================");
	}

}
